<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>es6继承</title>
</head>

<body>
    <script>
        // 子类 extends 父类
        // 子类的constructor内 书写 super()
        // 必须两个同时书写 super必须写在所有this前面 父类可以有es5的构造函数
        class Person {
            constructor(name, age) {
                this.name = name
                this.age = age
            }
            sayHi() {
                console.log('hello world');
            }
        }
        class Stundent extends Person {
            constructor(gender, ...arg) {
                super(...arg)
                this.gender = gender
            }

            play() {
                console.log('wwwwwwwwwwwwwwwwwwww');
            }
        }

        const s = new Stundent('nv', 'ziyuan', 18)
        console.log(s);
    </script>
</body>

</html>